package com.xyw.code.common.core.exception;

import lombok.Getter;

@Getter
public class BaseException extends RuntimeException {
    /**
     * 异常对应的错误类型
     */
    private final ErrorType errorType;

    /**
     * 默认是系统异常
     */
    public BaseException() {
        this.errorType = SystemErrorType.SYSTEM_ERROR;
    }

    public BaseException(ErrorType errorType) {
        this.errorType = errorType;
    }

    public BaseException(String code, String message) {
        BaseErrorType baseErrorType =  BaseErrorType.builder().code(code).msg(message).build();
        this.errorType = baseErrorType;
    }
}
